[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
dosexterr() Get DOS Extended Error Values
#include <dos.h>
int dosexterr(buffr);
struct DOSERROR *buffr;
dosexterr() sets the fields of 'buffr' to the values returned by the
MS-DOS system call 0x59. Setting 'buffr' to the NULL pointer causes
the function to return the value of AX, without filling in the fields
of 'buffr'.
Returns: The value in the AX register, (which is also set in
the 'exterror' field of 'buffr').
Notes: dosexterr() is only valid for MS-DOS version 3.0 or
later.
The structure type DOSERROR is defined (in <dos.h>
as:
struct DOSERROR {
int exterror;
char class;
char action;
char locus;
};
Portability: MS-DOS 3.0 and later only.
-------------------------------- Example ---------------------------------
The following statements try to open the file "testfile.dat". If this
fails, and the MS-DOS version is 3.0 or later, the program prints
extended error information.
#include <dos.h> /* for dosexterr() and struct DOSERROR */
#include <fcntl.h> /* for open() and O_RDWR */
#include <stdio.h> /* for printf() */
#include <stdlib.h> /* for _osmajor */
struct DOSERR doser;
int fd;
main()
{
if ((fd = open("testfile.dat", O_RDWR)) == -1) /* if error */
if (_osmajor >= 3) { /* if DOS 3.0 or later... */
dosexterr(&doser);
printf("error=%d, class=%d, action=%d, locus=%d\n",
doser.exterror, doser.class,
doser.action, doser.locus);
}
}
See Also:
perror()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson